﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using SimpleForum.Data.Models;
using SimpleForum.Data.Services;

namespace SimpleForum.Controllers
{
    public class ForumController : BaseController
    {
        private readonly IForumService ForumService;

        public ForumController(IForumService ForumService)
        {
            this.ForumService = ForumService;
        }

        public ActionResult View(int id)
        {
            var Forum = ForumService.GetForum(id);

            if (Forum != null) return View(Forum);
            else return EntityNotFound();
        }

        [HttpPost]
        [Authorize(Roles = "Administrator")]
        public ActionResult Create(Forum Forum)
        {
            Forum.CreatorId = Identity.User.Id;

            return View();
        }
    }
}